import request from './request'
import {passwordHash} from '../utilities/crypto'
import {app} from '../utilities/app'
// 模块列表
export function query ({currentPage = 1, perPage = 10, institutionNo, moduleName} = {}) {
  return request({
    url: '/module/queryModuleInfoPage.do',
    method: 'POST',
    body: {currentPage, perPage, institutionNo, moduleName}
  })
}
// 查询模块详情
export function queryDetail (id) {
  return request({
    url: '/module/queryModuleInfoDetail.do',
    method: 'POST',
    body: {id}
  })
}
// 新建模块
export function create ({institutionNo, moduleName, moduleDesc, bannerType, seq}) {
  return request({
    url: '/module/addModule.do',
    method: 'POST',
    body: {institutionNo, moduleName, moduleDesc, bannerType, seq}
  })
}
// 修改模块
export function edit ({id,moduleNo,institutionNo, moduleName, moduleDesc, bannerType, seq}) {
  return request({
    url: '/module/updateModuleInfoDetail.do',
    method: 'POST',
    body: {id,moduleNo,institutionNo, moduleName, moduleDesc, bannerType, seq}
  })
}
// 更改模块状态
export function change ({id,status}) {
  return request({
    url: '/module/updateModuleStatus.do',
    method: 'POST',
    body: {id,status}
  })
}

// 广告列表advert
export function queryAdvert ({currentPage = 1, perPage = 10, institutionNo, moduleNo} = {}) {
  return request({
    url: '/module/queryModuleBannerInfoPage.do',
    method: 'POST',
    body: {currentPage, perPage, institutionNo, moduleNo}
  })
}
//   广告详情
export function advertDetail (id) {
    return request({
      url: '/module/queryModuleBannerDetail.do',
      method: 'POST',
      body: {id}
    })
  }

  // 删除广告
export function delAdvert (id) {
  return request({
    url: '/module/deleteModuleBanner.do',
    method: 'POST',
    body: {id}
  })
}
  // 启用广告
export function openAdvert (id) {
  return request({
    url: '/module/updateModuleBannerStatusOpen.do',
    method: 'POST',
    body: {id}
  })
}
    // 禁用广告
export function closeAdvert (id) {
  return request({
    url: '/module/updateModuleBannerStatusClose.do',
    method: 'POST',
    body: {id}
  })
}

    // 模糊查询
export function seachPro (keyWord) {
  return request({
    url: '/console/product/fuzzySearchProduct.do',
    method: 'POST',
    body: {keyWord}
  })
}
